package com.gateway.springboot.starter.router.gray;

import com.gateway.router.gray.GrayRouterGatewayFilterFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: api-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2025/2/20 16:52
 **/
@Configuration
public class GrayRouterConfiguration {

    @Bean
//    @ConditionalOnBean(value = {DiscoveryClient.class, LoadBalancerClientFactory.class})
    public GrayRouterGatewayFilterFactory grayRouterGatewayFilterFactory(
            final DiscoveryClient discoveryClient,
            final LoadBalancerClientFactory loadBalancerClientFactory) {
        return new GrayRouterGatewayFilterFactory(discoveryClient, loadBalancerClientFactory);
    }
}
